﻿using System.Web.Mvc;

namespace mBlog.Areas.Admin
{
    public class AdminAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "admin";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "AdminDefault",
                "Admin",
                new { controller = "Home", action = "Index" },
                new[] { "mBlog.Admin.Controllers" }
                );

            //context.MapRoute(
            //    "AddPost",
            //    "Admin/Post/Add/",
            //    new { controller = "Post", action = "Add" },
            //    new[] { "mBlog.Admin.Controllers " }
            //    );

            context.MapRoute(
                "PostsUnderCategory",
                "Admin/{categoryUrl}/Posts",
                new { controller = "Post", action = "PostsByCategory" },
                new[] { "mBlog.Admin.Controllers" }
                );

            //context.MapRoute(
            //    "DeletePost",
            //    "Admin/Post/Delete/",
            //    new { controller = "Post", action = "Delete" },
            //    new[] { "mBlog.Admin.Controllers" }
            //    );

            //context.MapRoute(
            //    "DeletePostTag",
            //    "Admin/Post/DeleteTag/",
            //    new { controller = "Post", action = "DeleteTag" },
            //    new[] { "mBlog.Admin.Controllers" }
            //    );

            context.MapRoute(
               "EditPost",
               "Admin/Post/Edit/{postId}",
               new { controller = "Post", action = "Edit" },
               new[] { "mBlog.Admin.Controllers" }
               );

            context.MapRoute(
                "admin_default",
                "Admin/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional },
                new[] { "mBlog.Admin.Controllers" }
            );
        }
    }
}
